package com.weilx959.spt.plugin.e2sp.utils;

import com.weilx959.spt.core.LanguageContext;
import com.weilx959.spt.core.constants.CommonConstants;

import java.util.Optional;
import java.util.ResourceBundle;

public class ResourceBundleUtil {
    public static final String BASE_NAME = "com.weilx959.spt.plugin.e2sp.lang";

    private ResourceBundleUtil() {}

    public static ResourceBundle get() {
        return ResourceBundle.getBundle(BASE_NAME,
            Optional.ofNullable(LanguageContext.get())
                .orElse(CommonConstants.DEFAULT_LANGUAGE).getLocale());
    }
}
